define(function(require, factory) {
	'use strict';
	var libraryVM = avalon.define({
		$id: "lists",
        lists: []
	 });
	 
	 return (
		 avalon.controller(function($ctrl) {
			 $ctrl.$onRendered = function() {
				 console.log("library on rendered");
			 };
			 $ctrl.$onEnter = function() {
				 var library = new Library();
				 library.fetch({
					 success: function(data) {
						 libraryVM.lists = data.toJSON();
						 console.log( data.toJSON());
					 },
					 error: function(data, error) {
						 alert("fetch hanpend some error"+error);
					 }
				 })
				 console.log("library on enter");
			 }
		 })
	 )
});